clear all; close all; clc;

R=220;
C=33e-12;
L=100e-6;

tau=R*C;
fprintf('tau = %f ns\n', tau*1e9);

T=tau/10000;
t=0:T:(10*tau);
lt=length(t);

Uc=nan(1,lt);
dUc=nan(1,lt);
Ur=nan(1,lt);

f=0:1e6:3e8;
Uc(1)=0;
K=nan(1,length(f));
for k=1:length(f)
    E = cos(2*pi*f(k)*t);
for i=2:lt
    Uc(i)=(E(i)*T+R*C*Uc(i-1))/(T+R*C);
end
K(k)=max(Uc);
K1(k)=1/sqrt(1+(2*pi*f(k)*tau)^2);
end
figure(2);
plot(f*1e6,[K;K1]);
xlabel('f,MHz');
ylabel('K,Volt');
legend('K(t)');
grid on
